
<form role="form" class="epii" method="post" data-form="1" action="{url prescript take }">
    <div class="form-group">
        <label>处方金额：</label>
        <input type="text" name="r[total_price]" class="form-control" readonly value="{? $info.total_price}">
    </div>
    <div class="form-group">
        <label>取药状态：</label>
        <select class="selectpicker" name="r[status]">
            {:options,$status,$info.status}
        </select>
    </div>

    <div class="form-group">
        <label>支付状态：</label>
        <select class="selectpicker" name="r[payment_status]" disabled>
            {:options,$payment_status,$info.payment_status}
        </select>
    </div>
    <div class="form-group">
        <label>支付方式：</label>
        <select class="selectpicker" name="r[pay_type]"  onchange="show($(this))" {if $info['payment_status']==1}disabled{/if}>
            {:options,$pay_type,$info.pay_type}
        </select>
    </div>
    <div class="form-group hide" id="card">
        <label>会员卡：</label>
        <select class="selectpicker" name="r[card_id]" {if $info['payment_status']==1}disabled{/if}>
            {:options,$card_list,$info.card_id}
        </select>
    </div>
    <div class="form-group hide" id="desc">
        <label>支付简介：</label>
        <input type="text" name="r[desc]" class="form-control" value="{? $info.desc}" {if $info['payment_status']==1}readonly{/if}>
    </div>

    <input type="hidden" name="id" value="{$id?0}">
    <div class="form-footer">
        <button type="submit" class="btn btn-primary">提交</button>
    </div>
</form>
<script>
    //根据选择的支付方式 显示 选卡或者线下支付备注
    function show(obj){
        $type=obj.val();
        console.log($type)
        console.log(typeof $type)
        switch (parseInt($type)){
            case 0:
                $('#card').removeClass('hide');
                $('#desc').addClass('hide');
                break;
            case 1:
                $('#card').addClass('hide');
                $('#desc').removeClass('hide');
                break;
            default:
                $('#card').addClass('hide');
                $('#desc').addClass('hide');
                break;
        }
    }
    window.onEpiiInit(function () {
        let pay_type={? $info.pay_type ''};
        pay_type=parseInt(pay_type)
        if(!isNaN(pay_type)){
            switch (pay_type){
                case 0:
                    $('#card').removeClass('hide');
                    $('#desc').addClass('hide');
                    break;
                case 1:
                    $('#card').addClass('hide');
                    $('#desc').removeClass('hide');
                    break;
                default:
                    $('#card').addClass('hide');
                    $('#desc').addClass('hide');
                    break;
            }
        }
    })

</script>
